package com.woniu.adminservice.service.impl;

import com.woniu.adminservice.entity.RolesMenus;
import com.woniu.adminservice.dao.RolesMenusDao;
import com.woniu.adminservice.service.RolesMenusService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("rolesMenusService")
public class RolesMenusServiceImpl implements RolesMenusService {
    @Resource
    private RolesMenusDao rolesMenusDao;

    @Override
    public RolesMenus queryById(Integer id) {
        return rolesMenusDao.queryById(id);
    }

    @Override
    public List<RolesMenus> queryAllByLimit(int offset, int limit) {
        return rolesMenusDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<RolesMenus> findAll() {
        return rolesMenusDao.findAll();
    }

    @Override
    public RolesMenus insert(RolesMenus rolesMenus) {
        rolesMenusDao.insert(rolesMenus);
        return rolesMenus;
    }

    @Override
    public RolesMenus update(RolesMenus rolesMenus) {
        rolesMenusDao.update(rolesMenus);
        return queryById(rolesMenus.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return rolesMenusDao.deleteById(id) > 0;
    }
}